<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <title>登录后台</title>
    <link href="__CSS__/style.css" rel="stylesheet">
    <link href="__CSS__/style-responsive.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="__JS__/html5shiv.js"></script>
    <script src="__JS__/respond.min.js"></script>
    <![endif]-->
</head>

<body class="login-body" style="background-image:url('/Public/Rootadmin/img/bg.jpg')">

<div class="container" style="margin-left: 0px;margin-top: 100px;">
    <form id="login-form" class="form-signin" method="post">
        <div class="form-signin-heading text-center">
            <img src="__IMG__/login-logo.png" alt="" width="100"/>
        </div>
        <div class="login-wrap">
            <input id="name" type="text" class="form-control" placeholder="账号" autofocus>
            <input id="password" type="password" class="form-control" placeholder="密码">
            <button class="btn btn-lg btn-login btn-block" type="submit">
                <i class="fa fa-check"></i>
            </button>
        </div>
    </form>
</div>

<!-- Placed js at the end of the document so the pages load faster -->
<script src="__JS__/jquery-1.10.2.min.js"></script>
<script src="__JS__/bootstrap.min.js"></script>
<script src="__JS__/modernizr.min.js"></script>
<script src="__JS__/common.js"></script>
<script type="text/javascript">
    $(function(){
        $("#login-form").submit(function(){
            var name = $("#name").val();
            var password = $("#password").val();
            if(name == ""){
                $("#name").focus();
                return false;
            }
            if(password == ""){
                $("#password").focus();
                return false;
            }
            var url = "{:U('Rootadmin/login/index')}";

            $.post(url, {name:name, password:password}, function(res){
                console.log(res);
               if(res.success){
                   toast(res.msg, true);
                   setTimeout(function(){
                       window.location.href = "{:U('Rootadmin/index/index')}";
                   });
               }else{
                   toast(res.msg, false);
               }
            });
            return false;
        });
    })
</script>
</body>
</html>
